#include "bits/stdc++.h"

using namespace std;

int a[9] = {-2,1,-3,4,-1,2,1,-5,4};

int main() {
    int res = INT_MIN;
    int dp = a[0];

    for (int i = 1; i < 9; i++)
    {
        dp = max(dp+a[i], a[i]);
        res = max(res, dp);
    }

    cout << res << endl;    
}